package nowCoder;

import java.util.Scanner;

public class HJ18 {
    public static void main1(String[] args) {
        Scanner in = new Scanner(System.in);
        int a = 0;
        int b = 0;
        int c = 0;
        int d = 0;
        int e = 0;
        int s = 0;
        int err = 0;
        while (in.hasNext()) {
            try {
                String x = in.nextLine();
                String[] n = x.split("~");
                String[] y = n[0].split("\\.");
                int y1 = Integer.parseInt(y[0]);
                if (y1 == 0 || y1 == 127) {
                    continue;
                }
                if (!yanma(n[1])) {
                    err++;
                    continue;
                }
                int y2 = Integer.parseInt(y[1]);
                int y3 = Integer.parseInt(y[2]);
                int y4 = Integer.parseInt(y[3]);
                if (y1 == 10 || (y1 == 172 && y2 >= 16 && y2 <= 31) || (y1 == 192 && y2 == 168)) {
                    s++;
                }
                if (y1 <= 126) {
                    a++;
                    continue;
                }
                if (y1 <= 191) {
                    b++;
                    continue;
                }
                if (y1 <= 223) {
                    c++;
                    continue;
                }
                if (y1 <= 239) {
                    d++;
                    continue;
                }
                e++;
            } catch (Exception ee) {
                err++;
            }
            System.out.print(a + " " + b + " " + c + " " + d + " " + e + " " + err + " " + s);
        }
    }
    public static boolean yanma (String ip){
        String[] x = ip.split("\\.");
        int o = 1;
        for (int i = 0; i < x.length; i++) {
            if (x[i].isEmpty()) {
                return false;
            }
            int xx = Integer.parseInt(x[i]);
            if (i == 0 && xx == 0) {
                return false;
            }
            for (int j = 7; j >= 0; j--) {
                int n = xx >> j & 1;
                if (o < n) {
                    return false;
                }
                o = n;
            }
        }
        if (o == 1) {
            return false;
        }
        return true;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int a = 0;
        int b = 0;
        int c = 0;
        int d = 0;
        int e = 0;
        int err = 0;
        int si = 0;
        while(in.hasNext()){
            String x = in.nextLine();
            String[] y = x.split("~");
            String[] xip = y[0].split("\\.");
            if(xip.length != 4) {err++; continue;}
            int i1 = Integer.parseInt(xip[0]);
            if(i1 == 0 || i1 == 127) continue;
            if(i1 > 255 || i1 < 1) {err++; continue;}
            int i2 = Integer.parseInt(xip[1]);
            if(i2 > 255 || i2 < 0) {err++; continue;}
            int i3 = Integer.parseInt(xip[2]);
            if(i3 > 255 || i3 < 0) {err++; continue;}
            int i4 = Integer.parseInt(xip[3]);
            if(i4 > 255 || i4 < 0) {err++; continue;}
            if(!yjma(y[1])) {err++; continue;}
            if(i1 >= 1 && i1 <= 126){
                a++;
                if(i1 == 10) si++;
            }
            if(i1 >= 128 && i1 <= 191){
                b++;
                if(i1 == 172 && i2 >= 16 && i2 <= 31) si++;
            }
            if(i1 >= 192 && i1 <= 223){
                c++;
                if(i1 == 192 && i2 == 168) si++;
            }
            if(i1 >= 224 && i1 <= 239)
                d++;
            if(i1 >= 240)
                e++;
        }
        System.out.print(a+" "+b+" "+c+" "+d+" "+e+" "+err+" "+si);
    }
    public static boolean yjma(String str){
        String[] xip = str.split("\\.");
        if(xip.length != 4) return false;
        boolean bool = false;
        int f = -1;
        for(int i = 3; i >=0; i--){
            int x = Integer.parseInt(xip[i]);
            for(int j = 0; j <8; j++){
                boolean b = (x & (1 << j)) > 0;
                if(bool && !b) return false;
                if(b) bool = b;
                else f = j;
            }
        }
        return f != -1;
    }
}
